﻿Imports System.Data
Imports System.Data.Odbc
Imports WSEntidades
Imports Utilerias
Imports Npgsql
Imports MySql.Data.MySqlClient
Public Class AlumnosFact
    Public Shared Function Build(ByVal dr As MySqlDataReader) As AlumnosBE
        Dim tmpAlumnos As AlumnosBE = New AlumnosBE()
        Try
            With tmpAlumnos
                '.IdEmpresa = convertDTFromDb.convertInt32(dr.Item("IdEmpresa"))
                .IdAlumno = convertDTFromDb.convertInt32(dr.Item("IdAlumno"))
                .Nombre = convertDTFromDb.ConvertString(dr.Item("Nombre"))
                .Curp = convertDTFromDb.ConvertString(dr.Item("Curp"))
                Select Case convertDTFromDb.ConvertString(dr.Item("Nivel"))
                    Case "PRE"
                        .Nivel = AlumnosBE.EstatusNivel.Preescolar
                    Case "PRI"
                        .Nivel = AlumnosBE.EstatusNivel.Primaria
                    Case "SEC"
                        .Nivel = AlumnosBE.EstatusNivel.Secundaria
                    Case "PRO"
                        .Nivel = AlumnosBE.EstatusNivel.Profesional
                    Case "BAC"
                        .Nivel = AlumnosBE.EstatusNivel.Bachillerato
                    Case Else
                        .Nivel = AlumnosBE.EstatusNivel.Todos
                End Select
                Select Case convertDTFromDb.ConvertString(dr.Item("Status"))
                    Case "A"
                        .Status = AlumnosBE.EstatusAlumnos.Activo
                    Case "I"
                        .Status = AlumnosBE.EstatusAlumnos.Inactivo
                    Case Else
                        .Status = AlumnosBE.EstatusAlumnos.Inactivo
                End Select
            End With
            Return tmpAlumnos
        Catch ex As Exception
            Throw
        Finally
            tmpAlumnos = Nothing
        End Try
    End Function
End Class
